import 'package:flutter/material.dart';

class InstructionCard extends StatelessWidget {
  final List<String> instructions;
  final Color backgroundColor;

  const InstructionCard({
    Key? key,
    this.instructions = const [
      "操作步骤：",
      "1. 扫描区域二维码，获取该区域内的所有未完成维修任务",
      "2. 点击目标任务的“开始维修”",
      "3. 维修结束后点击目标任务的“结束维修”",
      "4. 等待报修人员确认维修结果",
    ],
    this.backgroundColor = const Color(0xFFF5F5F5),
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Card(
      elevation: 8.0, // 立体阴影效果
      margin: const EdgeInsets.all(16.0), // 移出Container
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(12.0),
      ),
      child: Container( // 这是Card的直接child
        padding: const EdgeInsets.all(20.0),
        decoration: BoxDecoration(
          color: backgroundColor,
          borderRadius: BorderRadius.circular(12.0),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisSize: MainAxisSize.min,
          children: instructions.map((instruction) {
            return Padding(
              padding: const EdgeInsets.symmetric(vertical: 4.0),
              child: Text(
                instruction,
                style: TextStyle(
                  fontSize: 16.0,
                  color: Colors.grey[800],
                  height: 1.4,
                ),
              ),
            );
          }).toList(),
        ),
      ),
    );
  }
}